package com.cat.math;

import java.util.ArrayList;
import java.util.List;

/**
*   @description https://leetcode.cn/problems/the-kth-factor-of-n/
*   @author 曲大人的喵
*   @create 2025/10/16 20:22
*   @since JDK17
*/

public class Solution14 {
    public int kthFactor(int n, int k) {
        List<Integer> list = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            if (n % i == 0) {
                list.add(i);
            }
        }

        return list.size() < k ? -1 : list.get(k);
    }
}
